From: Florian Müllner Date: Thu, 28 May 2020 22:35:27 +0000 (+0200) Subject: screenshot: Return an error when operation is blocked X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~345 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1fdd4ff31309506456da26897c76f3d852b557c0;p=gnome-shell.git screenshot: Return an error when operation is blocked Right now _createScreenshot() returns a tuple that indicates failure when a sender requests a screenshot operation before a previously started operation finished. However that doesn't work for the PickColor() method, as it uses a different return type than the other methods. Address this by returning an error instead, which works in any case; arguably trying to start multiple operations in parallel is an error by the caller more than it is a failed operation anyway. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1288 --- diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 7be9ba051..5b7e09387 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -37,7 +37,9 @@ var ScreenshotService = class { let sender = invocation.get_sender(); if (this._screenShooter.has(sender) || lockedDown) { - invocation.return_value(GLib.Variant.new('(bs)', [false, ''])); + invocation.return_error_literal( + Gio.IOErrorEnum, Gio.IOErrorEnum.BUSY, + 'There is an ongoing operation for this sender'); return null; }